# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1069.28.1 -> 1.1069.28.2
#	drivers/char/agp/agpgart_be.c	1.41.1.19 -> 1.41.1.20
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/22	trini@kernel.crashing.org	1.1069.17.13
# PPC32: Fix dependancies on uImage.
# --------------------------------------------
# 03/09/22	bjorn.helgaas@hp.com	1.1096
# Merge hp.com:/home/helgaas/linux/to-marcelo-2.4
# into hp.com:/home/helgaas/linux/linux-ia64-2.4
# --------------------------------------------
# 03/09/22	bjorn.helgaas@hp.com	1.1097
# Merge hp.com:/home/helgaas/linux/ia64-extras
# into hp.com:/home/helgaas/linux/linux-ia64-2.4
# --------------------------------------------
# 03/09/22	bjorn.helgaas@hp.com	1.1069.28.2
# AGP: (agp_allocate_memory): Replace agp_lookup_pte() with vmalloc_to_page().
# --------------------------------------------
#
diff -Nru a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c
--- a/drivers/char/agp/agpgart_be.c	Thu Oct  9 15:19:33 2003
+++ b/drivers/char/agp/agpgart_be.c	Thu Oct  9 15:19:33 2003
@@ -50,9 +50,6 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/page.h>
-#include <asm/pgalloc.h>
-#include <asm/pgtable.h>
-#include <asm/smplock.h>
 #ifdef CONFIG_AGP_NVIDIA
     #include <asm/msr.h>
 #endif
@@ -238,35 +235,6 @@
 
 #define IN_VMALLOC(_x)	  (((_x) >= VMALLOC_START) && ((_x) < VMALLOC_END))
 
-/*
- * Look up and return the pte corresponding to addr.  We only do this for
- * agp_ioremap'ed addresses. 
- */
-static pte_t *agp_lookup_pte(unsigned long addr)
-{ 
-	pgd_t			*dir;
-	pmd_t			*pmd;
-	pte_t			*pte;
-
-	if (!IN_VMALLOC(addr))
-		return NULL;
-
-	dir = pgd_offset_k(addr);
-	pmd = pmd_offset(dir, addr);
-
-	if (pmd) {
-		pte = pte_offset(pmd, addr);
-
-		if (pte) {
-			return pte;
-		} else {
-			return NULL;
-		}
-	} else {
-		return NULL;
-	}
-}
-
 #define ENTRIES_PER_PAGE		(PAGE_SIZE / sizeof(unsigned long))
 
 agp_memory *agp_allocate_memory(size_t page_count, u32 type)
@@ -305,7 +273,7 @@
 	if (agp_bridge.cant_use_aperture) {
 		void *vmblock;
 		unsigned long vaddr;
-		pte_t *pte;
+		struct page *page;
 
 		vmblock = __vmalloc(page_count << PAGE_SHIFT, GFP_KERNEL, PAGE_KERNEL);
 		if (vmblock == NULL) {
@@ -316,12 +284,12 @@
 		vaddr = (unsigned long) vmblock;
 
 		for (i = 0; i < page_count; i++, vaddr += PAGE_SIZE) {
-			pte = agp_lookup_pte(vaddr);
-			if (pte == NULL) {
+			page = vmalloc_to_page((void *) vaddr);
+			if (!page) {
 				MOD_DEC_USE_COUNT;
 				return NULL;
 			}
-			new->memory[i] = virt_to_phys(page_address(pte_page(*pte)));
+			new->memory[i] = virt_to_phys(page_address(page));
 		}
 
 		new->page_count = page_count;